fix(gui): resize share search results list dependent on required space
authorJyrki Gadinger <nilsding@nilsding.org>
Thu, 24 Apr 2025 11:20:46 +0000 (13:20 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 28 Apr 2025 07:46:32 +0000 (07:46 +0000)
In the case there are more search results present than there's space for
it, always display a scrollbar.  Some QtQuick themes don't make it
obvious that the list is scrollable.

Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
src/gui/filedetails/ShareeSearchField.qml

index 35c72b1ed5ef1683fe085f9e42fa91d05294b81b..adda7a987ea9dd178ca4fa3c2c5e44b6afdc909f 100644 (file)
@@ -161,7 +161,6 @@ TextField {
         id: suggestionsPopup
 
         width: root.width
-        height: 100
         y: root.height
 
         contentItem: ScrollView {
@@ -169,6 +168,11 @@ TextField {
 
             clip: true
             ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+            ScrollBar.vertical.policy: shareeListView.contentHeight > shareeListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
+
+            // need to take the popup's padding in account for the max height
+            // remove bottomPadding twice to leave some space between the window border
+            implicitHeight: Math.min(Window.height - parent.y - parent.topPadding - parent.bottomPadding * 2, contentHeight)
 
             ListView {
                 id: shareeListView